home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261a.zoo / info / gcc.info-13 < prev    next >
Encoding:
GNU Info File  |  1994-10-31  |  43.6 KB  |  1,001 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  31.  
  32. Registers and Memory
  33. ====================
  34.  
  35.    Here are the RTL expression types for describing access to machine
  36. registers and to main memory.
  37.  
  38. `(reg:M N)'
  39.      For small values of the integer N (those that are less than
  40.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  41.      register number N: a "hard register".  For larger values of N, it
  42.      stands for a temporary value or "pseudo register".  The compiler's
  43.      strategy is to generate code assuming an unlimited number of such
  44.      pseudo registers, and later convert them into hard registers or
  45.      into memory references.
  46.  
  47.      M is the machine mode of the reference.  It is necessary because
  48.      machines can generally refer to each register in more than one
  49.      mode.  For example, a register may contain a full word but there
  50.      may be instructions to refer to it as a half word or as a single
  51.      byte, as well as instructions to refer to it as a floating point
  52.      number of various precisions.
  53.  
  54.      Even for a register that the machine can access in only one mode,
  55.      the mode must always be specified.
  56.  
  57.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  58.      description, since the number of hard registers on the machine is
  59.      an invariant characteristic of the machine.  Note, however, that
  60.      not all of the machine registers must be general registers.  All
  61.      the machine registers that can be used for storage of data are
  62.      given hard register numbers, even those that can be used only in
  63.      certain instructions or can hold only certain types of data.
  64.  
  65.      A hard register may be accessed in various modes throughout one
  66.      function, but each pseudo register is given a natural mode and is
  67.      accessed only in that mode.  When it is necessary to describe an
  68.      access to a pseudo register using a nonnatural mode, a `subreg'
  69.      expression is used.
  70.  
  71.      A `reg' expression with a machine mode that specifies more than
  72.      one word of data may actually stand for several consecutive
  73.      registers.  If in addition the register number specifies a
  74.      hardware register, then it actually represents several consecutive
  75.      hardware registers starting with the specified one.
  76.  
  77.      Each pseudo register number used in a function's RTL code is
  78.      represented by a unique `reg' expression.
  79.  
  80.      Some pseudo register numbers, those within the range of
  81.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  82.      during the RTL generation phase and are eliminated before the
  83.      optimization phases.  These represent locations in the stack frame
  84.      that cannot be determined until RTL generation for the function
  85.      has been completed.  The following virtual register numbers are
  86.      defined:
  87.  
  88.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  89.           This points to the first word of the incoming arguments
  90.           passed on the stack.  Normally these arguments are placed
  91.           there by the caller, but the callee may have pushed some
  92.           arguments that were previously passed in registers.
  93.  
  94.           When RTL generation is complete, this virtual register is
  95.           replaced by the sum of the register given by
  96.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  97.  
  98.     `VIRTUAL_STACK_VARS_REGNUM'
  99.           If `FRAME_GROWS_DOWNWARD' is defined, this points to
  100.           immediately above the first variable on the stack.
  101.           Otherwise, it points to the first variable on the stack.
  102.  
  103.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  104.           register given by `FRAME_POINTER_REGNUM' and the value
  105.           `STARTING_FRAME_OFFSET'.
  106.  
  107.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  108.           This points to the location of dynamically allocated memory
  109.           on the stack immediately after the stack pointer has been
  110.           adjusted by the amount of memory desired.
  111.  
  112.           This virtual register is replaced by the sum of the register
  113.           given by `STACK_POINTER_REGNUM' and the value
  114.           `STACK_DYNAMIC_OFFSET'.
  115.  
  116.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  117.           This points to the location in the stack at which outgoing
  118.           arguments should be written when the stack is pre-pushed
  119.           (arguments pushed using push insns should always use
  120.           `STACK_POINTER_REGNUM').
  121.  
  122.           This virtual register is replaced by the sum of the register
  123.           given by `STACK_POINTER_REGNUM' and the value
  124.           `STACK_POINTER_OFFSET'.
  125.  
  126. `(subreg:M REG WORDNUM)'
  127.      `subreg' expressions are used to refer to a register in a machine
  128.      mode other than its natural one, or to refer to one register of a
  129.      multi-word `reg' that actually refers to several registers.
  130.  
  131.      Each pseudo-register has a natural mode.  If it is necessary to
  132.      operate on it in a different mode--for example, to perform a
  133.      fullword move instruction on a pseudo-register that contains a
  134.      single byte--the pseudo-register must be enclosed in a `subreg'.
  135.      In such a case, WORDNUM is zero.
  136.  
  137.      Usually M is at least as narrow as the mode of REG, in which case
  138.      it is restricting consideration to only the bits of REG that are
  139.      in M.
  140.  
  141.      Sometimes M is wider than the mode of REG.  These `subreg'
  142.      expressions are often called "paradoxical".  They are used in
  143.      cases where we want to refer to an object in a wider mode but do
  144.      not care what value the additional bits have.  The reload pass
  145.      ensures that paradoxical references are only made to hard
  146.      registers.
  147.  
  148.      The other use of `subreg' is to extract the individual registers of
  149.      a multi-register value.  Machine modes such as `DImode' and
  150.      `TImode' can indicate values longer than a word, values which
  151.      usually require two or more consecutive registers.  To access one
  152.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  153.      that says which register.
  154.  
  155.      Storing in a non-paradoxical `subreg' has undefined results for
  156.      bits belonging to the same word as the `subreg'.  This laxity makes
  157.      it easier to generate efficient code for such instructions.  To
  158.      represent an instruction that preserves all the bits outside of
  159.      those in the `subreg', use `strict_low_part' around the `subreg'.
  160.  
  161.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  162.      that word number zero is the most significant part; otherwise, it
  163.      is the least significant part.
  164.  
  165.      Between the combiner pass and the reload pass, it is possible to
  166.      have a paradoxical `subreg' which contains a `mem' instead of a
  167.      `reg' as its first operand.  After the reload pass, it is also
  168.      possible to have a non-paradoxical `subreg' which contains a
  169.      `mem'; this usually occurs when the `mem' is a stack slot which
  170.      replaced a pseudo register.
  171.  
  172.      Note that it is not valid to access a `DFmode' value in `SFmode'
  173.      using a `subreg'.  On some machines the most significant part of a
  174.      `DFmode' value does not have the same format as a single-precision
  175.      floating value.
  176.  
  177.      It is also not valid to access a single word of a multi-word value
  178.      in a hard register when less registers can hold the value than
  179.      would be expected from its size.  For example, some 32-bit
  180.      machines have floating-point registers that can hold an entire
  181.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  182.      (reg:DF 10) 1)' would be invalid because there is no way to
  183.      convert that reference to a single machine register.  The reload
  184.      pass prevents `subreg' expressions such as these from being formed.
  185.  
  186.      The first operand of a `subreg' expression is customarily accessed
  187.      with the `SUBREG_REG' macro and the second operand is customarily
  188.      accessed with the `SUBREG_WORD' macro.
  189.  
  190. `(scratch:M)'
  191.      This represents a scratch register that will be required for the
  192.      execution of a single instruction and not used subsequently.  It is
  193.      converted into a `reg' by either the local register allocator or
  194.      the reload pass.
  195.  
  196.      `scratch' is usually present inside a `clobber' operation (*note
  197.      Side Effects::.).
  198.  
  199. `(cc0)'
  200.      This refers to the machine's condition code register.  It has no
  201.      operands and may not have a machine mode.  There are two ways to
  202.      use it:
  203.  
  204.         * To stand for a complete set of condition code flags.  This is
  205.           best on most machines, where each comparison sets the entire
  206.           series of flags.
  207.  
  208.           With this technique, `(cc0)' may be validly used in only two
  209.           contexts: as the destination of an assignment (in test and
  210.           compare instructions) and in comparison operators comparing
  211.           against zero (`const_int' with value zero; that is to say,
  212.           `const0_rtx').
  213.  
  214.         * To stand for a single flag that is the result of a single
  215.           condition.  This is useful on machines that have only a
  216.           single flag bit, and in which comparison instructions must
  217.           specify the condition to test.
  218.  
  219.           With this technique, `(cc0)' may be validly used in only two
  220.           contexts: as the destination of an assignment (in test and
  221.           compare instructions) where the source is a comparison
  222.           operator, and as the first operand of `if_then_else' (in a
  223.           conditional branch).
  224.  
  225.      There is only one expression object of code `cc0'; it is the value
  226.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  227.      code `cc0' will return `cc0_rtx'.
  228.  
  229.      Instructions can set the condition code implicitly.  On many
  230.      machines, nearly all instructions set the condition code based on
  231.      the value that they compute or store.  It is not necessary to
  232.      record these actions explicitly in the RTL because the machine
  233.      description includes a prescription for recognizing the
  234.      instructions that do so (by means of the macro
  235.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  236.      whose sole purpose is to set the condition code, and instructions
  237.      that use the condition code, need mention `(cc0)'.
  238.  
  239.      On some machines, the condition code register is given a register
  240.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  241.      preferable approach if only a small subset of instructions modify
  242.      the condition code.  Other machines store condition codes in
  243.      general registers; in such cases a pseudo register should be used.
  244.  
  245.      Some machines, such as the Sparc and RS/6000, have two sets of
  246.      arithmetic instructions, one that sets and one that does not set
  247.      the condition code.  This is best handled by normally generating
  248.      the instruction that does not set the condition code, and making a
  249.      pattern that both performs the arithmetic and sets the condition
  250.      code register (which would not be `(cc0)' in this case).  For
  251.      examples, search for `addcc' and `andcc' in `sparc.md'.
  252.  
  253. `(pc)'
  254.      This represents the machine's program counter.  It has no operands
  255.      and may not have a machine mode.  `(pc)' may be validly used only
  256.      in certain specific contexts in jump instructions.
  257.  
  258.      There is only one expression object of code `pc'; it is the value
  259.      of the variable `pc_rtx'.  Any attempt to create an expression of
  260.      code `pc' will return `pc_rtx'.
  261.  
  262.      All instructions that do not jump alter the program counter
  263.      implicitly by incrementing it, but there is no need to mention
  264.      this in the RTL.
  265.  
  266. `(mem:M ADDR)'
  267.      This RTX represents a reference to main memory at an address
  268.      represented by the expression ADDR.  M specifies how large a unit
  269.      of memory is accessed.
  270.  
  271. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  272.  
  273. RTL Expressions for Arithmetic
  274. ==============================
  275.  
  276.    Unless otherwise specified, all the operands of arithmetic
  277. expressions must be valid for mode M.  An operand is valid for mode M
  278. if it has mode M, or if it is a `const_int' or `const_double' and M is
  279. a mode of class `MODE_INT'.
  280.  
  281.    For commutative binary operations, constants should be placed in the
  282. second operand.
  283.  
  284. `(plus:M X Y)'
  285.      Represents the sum of the values represented by X and Y carried
  286.      out in machine mode M.
  287.  
  288. `(lo_sum:M X Y)'
  289.      Like `plus', except that it represents that sum of X and the
  290.      low-order bits of Y.  The number of low order bits is
  291.      machine-dependent but is normally the number of bits in a `Pmode'
  292.      item minus the number of bits set by the `high' code (*note
  293.      Constants::.).
  294.  
  295.      M should be `Pmode'.
  296.  
  297. `(minus:M X Y)'
  298.      Like `plus' but represents subtraction.
  299.  
  300. `(compare:M X Y)'
  301.      Represents the result of subtracting Y from X for purposes of
  302.      comparison.  The result is computed without overflow, as if with
  303.      infinite precision.
  304.  
  305.      Of course, machines can't really subtract with infinite precision.
  306.      However, they can pretend to do so when only the sign of the
  307.      result will be used, which is the case when the result is stored
  308.      in the condition code.   And that is the only way this kind of
  309.      expression may validly be used: as a value to be stored in the
  310.      condition codes.
  311.  
  312.      The mode M is not related to the modes of X and Y, but instead is
  313.      the mode of the condition code value.  If `(cc0)' is used, it is
  314.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  315.      `CCmode'.  *Note Condition Code::.
  316.  
  317.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  318.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  319.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  320.      determines what mode the comparison is to be done in; thus it must
  321.      not be `VOIDmode'.
  322.  
  323.      If one of the operands is a constant, it should be placed in the
  324.      second operand and the comparison code adjusted as appropriate.
  325.  
  326.      A `compare' specifying two `VOIDmode' constants is not valid since
  327.      there is no way to know in what mode the comparison is to be
  328.      performed; the comparison must either be folded during the
  329.      compilation or the first operand must be loaded into a register
  330.      while its mode is still known.
  331.  
  332. `(neg:M X)'
  333.      Represents the negation (subtraction from zero) of the value
  334.      represented by X, carried out in mode M.
  335.  
  336. `(mult:M X Y)'
  337.      Represents the signed product of the values represented by X and Y
  338.      carried out in machine mode M.
  339.  
  340.      Some machines support a multiplication that generates a product
  341.      wider than the operands.  Write the pattern for this as
  342.  
  343.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  344.  
  345.      where M is wider than the modes of X and Y, which need not be the
  346.      same.
  347.  
  348.      Write patterns for unsigned widening multiplication similarly using
  349.      `zero_extend'.
  350.  
  351. `(div:M X Y)'
  352.      Represents the quotient in signed division of X by Y, carried out
  353.      in machine mode M.  If M is a floating point mode, it represents
  354.      the exact quotient; otherwise, the integerized quotient.
  355.  
  356.      Some machines have division instructions in which the operands and
  357.      quotient widths are not all the same; you should represent such
  358.      instructions using `truncate' and `sign_extend' as in,
  359.  
  360.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  361.  
  362. `(udiv:M X Y)'
  363.      Like `div' but represents unsigned division.
  364.  
  365. `(mod:M X Y)'
  366. `(umod:M X Y)'
  367.      Like `div' and `udiv' but represent the remainder instead of the
  368.      quotient.
  369.  
  370. `(smin:M X Y)'
  371. `(smax:M X Y)'
  372.      Represents the smaller (for `smin') or larger (for `smax') of X
  373.      and Y, interpreted as signed integers in mode M.
  374.  
  375. `(umin:M X Y)'
  376. `(umax:M X Y)'
  377.      Like `smin' and `smax', but the values are interpreted as unsigned
  378.      integers.
  379.  
  380. `(not:M X)'
  381.      Represents the bitwise complement of the value represented by X,
  382.      carried out in mode M, which must be a fixed-point machine mode.
  383.  
  384. `(and:M X Y)'
  385.      Represents the bitwise logical-and of the values represented by X
  386.      and Y, carried out in machine mode M, which must be a fixed-point
  387.      machine mode.
  388.  
  389. `(ior:M X Y)'
  390.      Represents the bitwise inclusive-or of the values represented by X
  391.      and Y, carried out in machine mode M, which must be a fixed-point
  392.      mode.
  393.  
  394. `(xor:M X Y)'
  395.      Represents the bitwise exclusive-or of the values represented by X
  396.      and Y, carried out in machine mode M, which must be a fixed-point
  397.      mode.
  398.  
  399. `(ashift:M X C)'
  400.      Represents the result of arithmetically shifting X left by C
  401.      places.  X have mode M, a fixed-point machine mode.  C be a
  402.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  403.      is determined by the mode called for in the machine description
  404.      entry for the left-shift instruction.  For example, on the Vax,
  405.      the mode of C is `QImode' regardless of M.
  406.  
  407. `(lshiftrt:M X C)'
  408. `(ashiftrt:M X C)'
  409.      Like `ashift' but for right shift.  Unlike the case for left shift,
  410.      these two operations are distinct.
  411.  
  412. `(rotate:M X C)'
  413. `(rotatert:M X C)'
  414.      Similar but represent left and right rotate.  If C is a constant,
  415.      use `rotate'.
  416.  
  417. `(abs:M X)'
  418.      Represents the absolute value of X, computed in mode M.
  419.  
  420. `(sqrt:M X)'
  421.      Represents the square root of X, computed in mode M.  Most often M
  422.      will be a floating point mode.
  423.  
  424. `(ffs:M X)'
  425.      Represents one plus the index of the least significant 1-bit in X,
  426.      represented as an integer of mode M.  (The value is zero if X is
  427.      zero.)  The mode of X need not be M; depending on the target
  428.      machine, various mode combinations may be valid.
  429.  
  430. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  431.  
  432. Comparison Operations
  433. =====================
  434.  
  435.    Comparison operators test a relation on two operands and are
  436. considered to represent a machine-dependent nonzero value described by,
  437. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  438. relation holds, or zero if it does not.  The mode of the comparison
  439. operation is independent of the mode of the data being compared.  If
  440. the comparison operation is being tested (e.g., the first operand of an
  441. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  442. operation is producing data to be stored in some variable, the mode
  443. must be in class `MODE_INT'.  All comparison operations producing data
  444. must use the same mode, which is machine-specific.
  445.  
  446.    There are two ways that comparison operations may be used.  The
  447. comparison operators may be used to compare the condition codes `(cc0)'
  448. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  449. actually refers to the result of the preceding instruction in which the
  450. condition codes were set.  The instructing setting the condition code
  451. must be adjacent to the instruction using the condition code; only
  452. `note' insns may separate them.
  453.  
  454.    Alternatively, a comparison operation may directly compare two data
  455. objects.  The mode of the comparison is determined by the operands; they
  456. must both be valid for a common machine mode.  A comparison with both
  457. operands constant would be invalid as the machine mode could not be
  458. deduced from it, but such a comparison should never exist in RTL due to
  459. constant folding.
  460.  
  461.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  462. the comparison operation is identical to `(eq X Y)'.  Usually only one
  463. style of comparisons is supported on a particular machine, but the
  464. combine pass will try to merge the operations to produce the `eq' shown
  465. in case it exists in the context of the particular insn involved.
  466.  
  467.    Inequality comparisons come in two flavors, signed and unsigned.
  468. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  469. unsigned greater-than.  These can produce different results for the same
  470. pair of integer values: for example, 1 is signed greater-than -1 but not
  471. unsigned greater-than, because -1 when regarded as unsigned is actually
  472. `0xffffffff' which is greater than 1.
  473.  
  474.    The signed comparisons are also used for floating point values.
  475. Floating point comparisons are distinguished by the machine modes of
  476. the operands.
  477.  
  478. `(eq:M X Y)'
  479.      1 if the values represented by X and Y are equal, otherwise 0.
  480.  
  481. `(ne:M X Y)'
  482.      1 if the values represented by X and Y are not equal, otherwise 0.
  483.  
  484. `(gt:M X Y)'
  485.      1 if the X is greater than Y.  If they are fixed-point, the
  486.      comparison is done in a signed sense.
  487.  
  488. `(gtu:M X Y)'
  489.      Like `gt' but does unsigned comparison, on fixed-point numbers
  490.      only.
  491.  
  492. `(lt:M X Y)'
  493. `(ltu:M X Y)'
  494.      Like `gt' and `gtu' but test for "less than".
  495.  
  496. `(ge:M X Y)'
  497. `(geu:M X Y)'
  498.      Like `gt' and `gtu' but test for "greater than or equal".
  499.  
  500. `(le:M X Y)'
  501. `(leu:M X Y)'
  502.      Like `gt' and `gtu' but test for "less than or equal".
  503.  
  504. `(if_then_else COND THEN ELSE)'
  505.      This is not a comparison operation but is listed here because it is
  506.      always used in conjunction with a comparison operation.  To be
  507.      precise, COND is a comparison expression.  This expression
  508.      represents a choice, according to COND, between the value
  509.      represented by THEN and the one represented by ELSE.
  510.  
  511.      On most machines, `if_then_else' expressions are valid only to
  512.      express conditional jumps.
  513.  
  514. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  515.      Similar to `if_then_else', but more general.  Each of TEST1,
  516.      TEST2, ... is performed in turn.  The result of this expression is
  517.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  518.      none of the tests are non-zero expressions.
  519.  
  520.      This is currently not valid for instruction patterns and is
  521.      supported only for insn attributes.  *Note Insn Attributes::.
  522.  
  523. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  524.  
  525. Bit Fields
  526. ==========
  527.  
  528.    Special expression codes exist to represent bitfield instructions.
  529. These types of expressions are lvalues in RTL; they may appear on the
  530. left side of an assignment, indicating insertion of a value into the
  531. specified bit field.
  532.  
  533. `(sign_extract:M LOC SIZE POS)'
  534.      This represents a reference to a sign-extended bit field contained
  535.      or starting in LOC (a memory or register reference).  The bit field
  536.      is SIZE bits wide and starts at bit POS.  The compilation option
  537.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  538.      from.
  539.  
  540.      If LOC is in memory, its mode must be a single-byte integer mode.
  541.      If LOC is in a register, the mode to use is specified by the
  542.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  543.      and is usually a full-word integer mode.
  544.  
  545.      The mode of POS is machine-specific and is also specified in the
  546.      `insv' or `extv' pattern.
  547.  
  548.      The mode M is the same as the mode that would be used for LOC if
  549.      it were a register.
  550.  
  551. `(zero_extract:M LOC SIZE POS)'
  552.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  553.      field.  The same sequence of bits are extracted, but they are
  554.      filled to an entire word with zeros instead of by sign-extension.
  555.  
  556. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  557.  
  558. Conversions
  559. ===========
  560.  
  561.    All conversions between machine modes must be represented by
  562. explicit conversion operations.  For example, an expression which is
  563. the sum of a byte and a full word cannot be written as `(plus:SI
  564. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  565. operands of the same machine mode.  Therefore, the byte-sized operand
  566. is enclosed in a conversion operation, as in
  567.  
  568.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  569.  
  570.    The conversion operation is not a mere placeholder, because there
  571. may be more than one way of converting from a given starting mode to
  572. the desired final mode.  The conversion operation code says how to do
  573. it.
  574.  
  575.    For all conversion operations, X must not be `VOIDmode' because the
  576. mode in which to do the conversion would not be known.  The conversion
  577. must either be done at compile-time or X must be placed into a register.
  578.  
  579. `(sign_extend:M X)'
  580.      Represents the result of sign-extending the value X to machine
  581.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  582.      a mode narrower than M.
  583.  
  584. `(zero_extend:M X)'
  585.      Represents the result of zero-extending the value X to machine
  586.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  587.      a mode narrower than M.
  588.  
  589. `(float_extend:M X)'
  590.      Represents the result of extending the value X to machine mode M.
  591.      m must be a floating point mode and X a floating point value of a
  592.      mode narrower than M.
  593.  
  594. `(truncate:M X)'
  595.      Represents the result of truncating the value X to machine mode M.
  596.      M must be a fixed-point mode and X a fixed-point value of a mode
  597.      wider than M.
  598.  
  599. `(float_truncate:M X)'
  600.      Represents the result of truncating the value X to machine mode M.
  601.      M must be a floating point mode and X a floating point value of a
  602.      mode wider than M.
  603.  
  604. `(float:M X)'
  605.      Represents the result of converting fixed point value X, regarded
  606.      as signed, to floating point mode M.
  607.  
  608. `(unsigned_float:M X)'
  609.      Represents the result of converting fixed point value X, regarded
  610.      as unsigned, to floating point mode M.
  611.  
  612. `(fix:M X)'
  613.      When M is a fixed point mode, represents the result of converting
  614.      floating point value X to mode M, regarded as signed.  How
  615.      rounding is done is not specified, so this operation may be used
  616.      validly in compiling C code only for integer-valued operands.
  617.  
  618. `(unsigned_fix:M X)'
  619.      Represents the result of converting floating point value X to
  620.      fixed point mode M, regarded as unsigned.  How rounding is done is
  621.      not specified.
  622.  
  623. `(fix:M X)'
  624.      When M is a floating point mode, represents the result of
  625.      converting floating point value X (valid for mode M) to an
  626.      integer, still represented in floating point mode M, by rounding
  627.      towards zero.
  628.  
  629. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  630.  
  631. Declarations
  632. ============
  633.  
  634.    Declaration expression codes do not represent arithmetic operations
  635. but rather state assertions about their operands.
  636.  
  637. `(strict_low_part (subreg:M (reg:N R) 0))'
  638.      This expression code is used in only one context: as the
  639.      destination operand of a `set' expression.  In addition, the
  640.      operand of this expression must be a non-paradoxical `subreg'
  641.      expression.
  642.  
  643.      The presence of `strict_low_part' says that the part of the
  644.      register which is meaningful in mode N, but is not part of mode M,
  645.      is not to be altered.  Normally, an assignment to such a subreg is
  646.      allowed to have undefined effects on the rest of the register when
  647.      M is less than a word.
  648.  
  649. File: gcc.info,  Node: Side Effects,  Next: Incdec,  Prev: RTL Declarations,  Up: RTL
  650.  
  651. Side Effect Expressions
  652. =======================
  653.  
  654.    The expression codes described so far represent values, not actions.
  655. But machine instructions never produce values; they are meaningful only
  656. for their side effects on the state of the machine.  Special expression
  657. codes are used to represent side effects.
  658.  
  659.    The body of an instruction is always one of these side effect codes;
  660. the codes described above, which represent values, appear only as the
  661. operands of these.
  662.  
  663. `(set LVAL X)'
  664.      Represents the action of storing the value of X into the place
  665.      represented by LVAL.  LVAL must be an expression representing a
  666.      place that can be stored in: `reg' (or `subreg' or
  667.      `strict_low_part'), `mem', `pc' or `cc0'.
  668.  
  669.      If LVAL is a `reg', `subreg' or `mem', it has a machine mode; then
  670.      X must be valid for that mode.
  671.  
  672.      If LVAL is a `reg' whose machine mode is less than the full width
  673.      of the register, then it means that the part of the register
  674.      specified by the machine mode is given the specified value and the
  675.      rest of the register receives an undefined value.  Likewise, if
  676.      LVAL is a `subreg' whose machine mode is narrower than the mode of
  677.      the register, the rest of the register can be changed in an
  678.      undefined way.
  679.  
  680.      If LVAL is a `strict_low_part' of a `subreg', then the part of the
  681.      register specified by the machine mode of the `subreg' is given
  682.      the value X and the rest of the register is not changed.
  683.  
  684.      If LVAL is `(cc0)', it has no machine mode, and X may be either a
  685.      `compare' expression or a value that may have any mode.  The
  686.      latter case represents a "test" instruction.  The expression `(set
  687.      (cc0) (reg:M N))' is equivalent to `(set (cc0) (compare (reg:M N)
  688.      (const_int 0)))'.  Use the former expression to save space during
  689.      the compilation.
  690.  
  691.      If LVAL is `(pc)', we have a jump instruction, and the
  692.      possibilities for X are very limited.  It may be a `label_ref'
  693.      expression (unconditional jump).  It may be an `if_then_else'
  694.      (conditional jump), in which case either the second or the third
  695.      operand must be `(pc)' (for the case which does not jump) and the
  696.      other of the two must be a `label_ref' (for the case which does
  697.      jump).  X may also be a `mem' or `(plus:SI (pc) Y)', where Y may
  698.      be a `reg' or a `mem'; these unusual patterns are used to
  699.      represent jumps through branch tables.
  700.  
  701.      If LVAL is neither `(cc0)' nor `(pc)', the mode of LVAL must not
  702.      be `VOIDmode' and the mode of X must be valid for the mode of LVAL.
  703.  
  704.      LVAL is customarily accessed with the `SET_DEST' macro and X with
  705.      the `SET_SRC' macro.
  706.  
  707. `(return)'
  708.      As the sole expression in a pattern, represents a return from the
  709.      current function, on machines where this can be done with one
  710.      instruction, such as Vaxes.  On machines where a multi-instruction
  711.      "epilogue" must be executed in order to return from the function,
  712.      returning is done by jumping to a label which precedes the
  713.      epilogue, and the `return' expression code is never used.
  714.  
  715.      Inside an `if_then_else' expression, represents the value to be
  716.      placed in `pc' to return to the caller.
  717.  
  718.      Note that an insn pattern of `(return)' is logically equivalent to
  719.      `(set (pc) (return))', but the latter form is never used.
  720.  
  721. `(call FUNCTION NARGS)'
  722.      Represents a function call.  FUNCTION is a `mem' expression whose
  723.      address is the address of the function to be called.  NARGS is an
  724.      expression which can be used for two purposes: on some machines it
  725.      represents the number of bytes of stack argument; on others, it
  726.      represents the number of argument registers.
  727.  
  728.      Each machine has a standard machine mode which FUNCTION must have.
  729.      The machine description defines macro `FUNCTION_MODE' to expand
  730.      into the requisite mode name.  The purpose of this mode is to
  731.      specify what kind of addressing is allowed, on machines where the
  732.      allowed kinds of addressing depend on the machine mode being
  733.      addressed.
  734.  
  735. `(clobber X)'
  736.      Represents the storing or possible storing of an unpredictable,
  737.      undescribed value into X, which must be a `reg', `scratch' or
  738.      `mem' expression.
  739.  
  740.      One place this is used is in string instructions that store
  741.      standard values into particular hard registers.  It may not be
  742.      worth the trouble to describe the values that are stored, but it
  743.      is essential to inform the compiler that the registers will be
  744.      altered, lest it attempt to keep data in them across the string
  745.      instruction.
  746.  
  747.      If X is `(mem:BLK (const_int 0))', it means that all memory
  748.      locations must be presumed clobbered.
  749.  
  750.      Note that the machine description classifies certain hard
  751.      registers as "call-clobbered".  All function call instructions are
  752.      assumed by default to clobber these registers, so there is no need
  753.      to use `clobber' expressions to indicate this fact.  Also, each
  754.      function call is assumed to have the potential to alter any memory
  755.      location, unless the function is declared `const'.
  756.  
  757.      If the last group of expressions in a `parallel' are each a
  758.      `clobber' expression whose arguments are `reg' or `match_scratch'
  759.      (*note RTL Template::.) expressions, the combiner phase can add
  760.      the appropriate `clobber' expressions to an insn it has
  761.      constructed when doing so will cause a pattern to be matched.
  762.  
  763.      This feature can be used, for example, on a machine that whose
  764.      multiply and add instructions don't use an MQ register but which
  765.      has an add-accumulate instruction that does clobber the MQ
  766.      register.  Similarly, a combined instruction might require a
  767.      temporary register while the constituent instructions might not.
  768.  
  769.      When a `clobber' expression for a register appears inside a
  770.      `parallel' with other side effects, the register allocator
  771.      guarantees that the register is unoccupied both before and after
  772.      that insn.  However, the reload phase may allocate a register used
  773.      for one of the inputs unless the `&' constraint is specified for
  774.      the selected alternative (*note Modifiers::.).  You can clobber
  775.      either a specific hard register, a pseudo register, or a `scratch'
  776.      expression; in the latter two cases, GNU CC will allocate a hard
  777.      register that is available there for use as a temporary.
  778.  
  779.      For instructions that require a temporary register, you should use
  780.      `scratch' instead of a pseudo-register because this will allow the
  781.      combiner phase to add the `clobber' when required.  You do this by
  782.      coding (`clobber' (`match_scratch' ...)).  If you do clobber a
  783.      pseudo register, use one which appears nowhere else--generate a
  784.      new one each time.  Otherwise, you may confuse CSE.
  785.  
  786.      There is one other known use for clobbering a pseudo register in a
  787.      `parallel': when one of the input operands of the insn is also
  788.      clobbered by the insn.  In this case, using the same pseudo
  789.      register in the clobber and elsewhere in the insn produces the
  790.      expected results.
  791.  
  792. `(use X)'
  793.      Represents the use of the value of X.  It indicates that the value
  794.      in X at this point in the program is needed, even though it may
  795.      not be apparent why this is so.  Therefore, the compiler will not
  796.      attempt to delete previous instructions whose only effect is to
  797.      store a value in X.  X must be a `reg' expression.
  798.  
  799.      During the delayed branch scheduling phase, X may be an insn.
  800.      This indicates that X previously was located at this place in the
  801.      code and its data dependencies need to be taken into account.
  802.      These `use' insns will be deleted before the delayed branch
  803.      scheduling phase exits.
  804.  
  805. `(parallel [X0 X1 ...])'
  806.      Represents several side effects performed in parallel.  The square
  807.      brackets stand for a vector; the operand of `parallel' is a vector
  808.      of expressions.  X0, X1 and so on are individual side effect
  809.      expressions--expressions of code `set', `call', `return',
  810.      `clobber' or `use'.
  811.  
  812.      "In parallel" means that first all the values used in the
  813.      individual side-effects are computed, and second all the actual
  814.      side-effects are performed.  For example,
  815.  
  816.           (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
  817.                      (set (mem:SI (reg:SI 1)) (reg:SI 1))])
  818.  
  819.      says unambiguously that the values of hard register 1 and the
  820.      memory location addressed by it are interchanged.  In both places
  821.      where `(reg:SI 1)' appears as a memory address it refers to the
  822.      value in register 1 *before* the execution of the insn.
  823.  
  824.      It follows that it is *incorrect* to use `parallel' and expect the
  825.      result of one `set' to be available for the next one.  For
  826.      example, people sometimes attempt to represent a jump-if-zero
  827.      instruction this way:
  828.  
  829.           (parallel [(set (cc0) (reg:SI 34))
  830.                      (set (pc) (if_then_else
  831.                                   (eq (cc0) (const_int 0))
  832.                                   (label_ref ...)
  833.                                   (pc)))])
  834.  
  835.      But this is incorrect, because it says that the jump condition
  836.      depends on the condition code value *before* this instruction, not
  837.      on the new value that is set by this instruction.
  838.  
  839.      Peephole optimization, which takes place together with final
  840.      assembly code output, can produce insns whose patterns consist of
  841.      a `parallel' whose elements are the operands needed to output the
  842.      resulting assembler code--often `reg', `mem' or constant
  843.      expressions.  This would not be well-formed RTL at any other stage
  844.      in compilation, but it is ok then because no further optimization
  845.      remains to be done.  However, the definition of the macro
  846.      `NOTICE_UPDATE_CC', if any, must deal with such insns if you
  847.      define any peephole optimizations.
  848.  
  849. `(sequence [INSNS ...])'
  850.      Represents a sequence of insns.  Each of the INSNS that appears in
  851.      the vector is suitable for appearing in the chain of insns, so it
  852.      must be an `insn', `jump_insn', `call_insn', `code_label',
  853.      `barrier' or `note'.
  854.  
  855.      A `sequence' RTX is never placed in an actual insn during RTL
  856.      generation.  It represents the sequence of insns that result from a
  857.      `define_expand' *before* those insns are passed to `emit_insn' to
  858.      insert them in the chain of insns.  When actually inserted, the
  859.      individual sub-insns are separated out and the `sequence' is
  860.      forgotten.
  861.  
  862.      After delay-slot scheduling is completed, an insn and all the
  863.      insns that reside in its delay slots are grouped together into a
  864.      `sequence'.  The insn requiring the delay slot is the first insn
  865.      in the vector; subsequent insns are to be placed in the delay slot.
  866.  
  867.      `INSN_ANNULLED_BRANCH_P' is set on an insn in a delay slot to
  868.      indicate that a branch insn should be used that will conditionally
  869.      annul the effect of the insns in the delay slots.  In such a case,
  870.      `INSN_FROM_TARGET_P' indicates that the insn is from the target of
  871.      the branch and should be executed only if the branch is taken;
  872.      otherwise the insn should be executed only if the branch is not
  873.      taken.  *Note Delay Slots::.
  874.  
  875.    These expression codes appear in place of a side effect, as the body
  876. of an insn, though strictly speaking they do not always describe side
  877. effects as such:
  878.  
  879. `(asm_input S)'
  880.      Represents literal assembler code as described by the string S.
  881.  
  882. `(unspec [OPERANDS ...] INDEX)'
  883. `(unspec_volatile [OPERANDS ...] INDEX)'
  884.      Represents a machine-specific operation on OPERANDS.  INDEX
  885.      selects between multiple machine-specific operations.
  886.      `unspec_volatile' is used for volatile operations and operations
  887.      that may trap; `unspec' is used for other operations.
  888.  
  889.      These codes may appear inside a `pattern' of an insn, inside a
  890.      `parallel', or inside an expression.
  891.  
  892. `(addr_vec:M [LR0 LR1 ...])'
  893.      Represents a table of jump addresses.  The vector elements LR0,
  894.      etc., are `label_ref' expressions.  The mode M specifies how much
  895.      space is given to each address; normally M would be `Pmode'.
  896.  
  897. `(addr_diff_vec:M BASE [LR0 LR1 ...])'
  898.      Represents a table of jump addresses expressed as offsets from
  899.      BASE.  The vector elements LR0, etc., are `label_ref' expressions
  900.      and so is BASE.  The mode M specifies how much space is given to
  901.      each address-difference.
  902.  
  903. File: gcc.info,  Node: Incdec,  Next: Assembler,  Prev: Side Effects,  Up: RTL
  904.  
  905. Embedded Side-Effects on Addresses
  906. ==================================
  907.  
  908.    Four special side-effect expression codes appear as memory addresses.
  909.  
  910. `(pre_dec:M X)'
  911.      Represents the side effect of decrementing X by a standard amount
  912.      and represents also the value that X has after being decremented.
  913.      x must be a `reg' or `mem', but most machines allow only a `reg'.
  914.      m must be the machine mode for pointers on the machine in use.
  915.      The amount X is decremented by is the length in bytes of the
  916.      machine mode of the containing memory reference of which this
  917.      expression serves as the address.  Here is an example of its use:
  918.  
  919.           (mem:DF (pre_dec:SI (reg:SI 39)))
  920.  
  921.      This says to decrement pseudo register 39 by the length of a
  922.      `DFmode' value and use the result to address a `DFmode' value.
  923.  
  924. `(pre_inc:M X)'
  925.      Similar, but specifies incrementing X instead of decrementing it.
  926.  
  927. `(post_dec:M X)'
  928.      Represents the same side effect as `pre_dec' but a different
  929.      value.  The value represented here is the value X has before being
  930.      decremented.
  931.  
  932. `(post_inc:M X)'
  933.      Similar, but specifies incrementing X instead of decrementing it.
  934.  
  935.    These embedded side effect expressions must be used with care.
  936. Instruction patterns may not use them.  Until the `flow' pass of the
  937. compiler, they may occur only to represent pushes onto the stack.  The
  938. `flow' pass finds cases where registers are incremented or decremented
  939. in one instruction and used as an address shortly before or after;
  940. these cases are then transformed to use pre- or post-increment or
  941. -decrement.
  942.  
  943.    If a register used as the operand of these expressions is used in
  944. another address in an insn, the original value of the register is used.
  945. Uses of the register outside of an address are not permitted within the
  946. same insn as a use in an embedded side effect expression because such
  947. insns behave differently on different machines and hence must be treated
  948. as ambiguous and disallowed.
  949.  
  950.    An instruction that can be represented with an embedded side effect
  951. could also be represented using `parallel' containing an additional
  952. `set' to describe how the address register is altered.  This is not
  953. done because machines that allow these operations at all typically
  954. allow them wherever a memory address is called for.  Describing them as
  955. additional parallel stores would require doubling the number of entries
  956. in the machine description.
  957.  
  958. File: gcc.info,  Node: Assembler,  Next: Insns,  Prev: Incdec,  Up: RTL
  959.  
  960. Assembler Instructions as Expressions
  961. =====================================
  962.  
  963.    The RTX code `asm_operands' represents a value produced by a
  964. user-specified assembler instruction.  It is used to represent an `asm'
  965. statement with arguments.  An `asm' statement with a single output
  966. operand, like this:
  967.  
  968.      asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
  969.  
  970. is represented using a single `asm_operands' RTX which represents the
  971. value that is stored in `outputvar':
  972.  
  973.      (set RTX-FOR-OUTPUTVAR
  974.           (asm_operands "foo %1,%2,%0" "a" 0
  975.                         [RTX-FOR-ADDITION-RESULT RTX-FOR-*Z]
  976.                         [(asm_input:M1 "g")
  977.                          (asm_input:M2 "di")]))
  978.  
  979. Here the operands of the `asm_operands' RTX are the assembler template
  980. string, the output-operand's constraint, the index-number of the output
  981. operand among the output operands specified, a vector of input operand
  982. RTX's, and a vector of input-operand modes and constraints.  The mode
  983. M1 is the mode of the sum `x+y'; M2 is that of `*z'.
  984.  
  985.    When an `asm' statement has multiple output values, its insn has
  986. several such `set' RTX's inside of a `parallel'.  Each `set' contains a
  987. `asm_operands'; all of these share the same assembler template and
  988. vectors, but each contains the constraint for the respective output
  989. operand.  They are also distinguished by the output-operand index
  990. number, which is 0, 1, ... for successive output operands.
  991.  
  992.